package com.macro.mall.portal.controller;

import com.macro.mall.portal.domain.Product;
import com.macro.mall.portal.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author：尚志豪
 * @Package：com.macro.mall.portal.controller
 * @Project：mall-swarm-B
 * @name：ProductController
 * @Date：2024/11/1 17:25
 */
@RestController
@RequestMapping("/products")
public class ProductController {

    @Autowired
    private ProductService productService;

    @PostMapping("/preheat")
    public String preheatProducts(@RequestBody List<Long> productIds){
        productService.preheatProducts(productIds);
        return "Products preheated successfully!";
    }

    @GetMapping("/preheated")
    public List<Product> getPreheatedProducts(){
        return productService.getPreheatedProducts();
    }

}
